/**
 * Copyright (c) 2016-2019 人人开源 All rights reserved.
 *
 * https://www.renren.io
 *
 * 版权所有，侵权必究！
 */

package io.renren;

import io.renren.common.config.TemplateInterceptor;
import io.renren.common.config.WeixinInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;


@SpringBootApplication
public class AdminApplication implements WebMvcConfigurer {

	@Autowired
	private TemplateInterceptor templateInterceptor;
	@Autowired
	private WeixinInterceptor weixinInterceptor;

	@Override
	public void addInterceptors(InterceptorRegistry registry) {
		registry.addInterceptor(templateInterceptor).addPathPatterns("/h5/**")
				.addPathPatterns("/busi/**")
				.addPathPatterns("/beer/**")
				.excludePathPatterns("**/createImg**");

		registry.addInterceptor(weixinInterceptor).addPathPatterns("/h5/**")
				.addPathPatterns("/busi/**")
				.addPathPatterns("/beer/**")
				.excludePathPatterns("**/createImg**");
	}

	public static void main(String[] args) {
		SpringApplication.run(AdminApplication.class, args);
	}

}
